<template>
	<view>
		<view class="messageType" v-for="(item,index) in list" @click="NAVPAGE('/pages/content/privateChat/privateChat')">
			<view class="headImg">
				<view class="headImg_badge" v-show="badgeFlag"><u-badge :isDot="true" bgColor="red"
						type="success"></u-badge></view>
				<u-avatar :src="item.img"></u-avatar>
			</view>
			<view class="name">
				<view class="type">
					<view style="font-size: 30rpx;">星月夜</view>
					<view>3分钟前</view>
				</view>
				<view class="type a">
					<view>你叫什么名字</view>
					<view v-show="!badgeFlag"><u-badge max="99" bgColor="red" :isDot="false" type="success"
							value="2"></u-badge></view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			badgeFlag: {
				type: Boolean,
				default: false // 使用 default 设置默认值
			},
			list: {
				type: Array,
				default: () => []
			}
		}
	}
</script>

<style scoped lang="scss">
	.messageType {
		width: 90%;
		margin: auto;
		display: flex;
		padding: 30rpx 0;

		.headImg {
			width: 20%;
			display: flex;
			align-items: center;
			justify-content: center;

			.headImg_badge {
				position: relative;
				left: 4px;
				top: -18px;
			}
		}

		.name {
			width: 80%;
			font-size: 24rpx;

			.type {
				width: 100%;
				line-height: 1.5;
				display: flex;
				justify-content: space-between;
				align-items: center;
			}

			.a {
				width: 95%;
			}
		}
	}
</style>